<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-5-23
 * Time: 下午11:27
 */
/*
 * 数组方式定义菜单，可选择下面三种方式
 * 推荐使用第一种
 * 1 2 种方式 需要 Controller::ParseArrMenu()方法解析
 * 3 种方式 直接完整定义 不是很方便，容易混淆
 * */
class GaaMenu {
    //再次简化定义，用函数解析下面的数组 还原为 self::menus()类型的数组
    static public function lastMenu()
    {
        return array(
            'builder'       => 'Home,builder/builder',
            'gapp'      => 'APP,builder/gapp',
            'gmodule'   => 'Module,builder/gmodule',
            'mvc'       => 'Build MVC,empty',
            'mvc:son'   => array(//son: sub menu
                    'gmodel'  => 'Build Model,builder/gmodel',
                    'gview'   => 'Build View,builder/gview',
                    'gcontrol'=> 'Build Controller,builder/gcontrol'
                )
        );
    }
    //简化定义，用函数解析下面的数组 还原为 self::menus()类型的数组
    static public function newMenu()
    {
        return array(
            array('builder','Home,builder/builder'),
            array('gapp','APP,builder/gapp'),
            array('gmodule','Module,builder/gmodule'),
            array('mvc','Build MVC,empty',
                array(//son: sub menu
                    array('gmodel'  ,'Build Model,builder/gmodel'),
                    array('gview'   ,'Build View,builder/gview'),
                    array('gcontrol','Build Controller,builder/gcontrol')
                )
            )
        );
    }
    static public function menus()
    {
        return array(
            'builder'   =>array(
                'name'      =>'Home',
                'url'       =>'builder/builder',
            ),
            'gapp'   =>array(
                'name'      =>'APP',
                'url'       =>'builder/gapp',
            ),
            'gmodule'   =>array(
                'name'      =>'Module',
                'url'       =>'builder/gmodule',
            ),
            'mvc'   =>array(
                'name'      =>'Build MVC',
                //'url'       =>'builder/mvc' | empty
                'son'       =>array(
                    'gmodel'   =>array(
                        'name'      =>'Build Model',
                        'url'       =>'builder/gmodel',
                    ),
                    'gview'   =>array(
                        'name'      =>'Build View',
                        'url'       =>'builder/gview',
                    ),
                    'gcontrol'   =>array(
                        'name'      =>'Build Controller',
                        'url'       =>'builder/gcontrol',
                    ),
                )
            ),
        );
    }

}